import { Base } from '../../../utils/base.js'
const app = getApp()
class Product extends Base {
  constructor() {
    super()
  }

  /*得到产品列表*/
  getProductList(data, callback) {
    let school_id = wx.getStorageSync('school_id')
    let param = {
      url: app.globalData.api + '/api/v1.0/products/list/' + school_id,
      data,
      showLoading: true,
      sCallback: (res) => {
        callback && callback(res.data)
      }
    }
    this.request(param)
  }

  /*得到产品详情*/
  getProductDetail(data, callback) {
    let param = {
      url: app.globalData.api + '/api/v1.0/products/detail/' + data['product_id'],
      data,
      sCallback: (res) => {
        callback && callback(res.data.data)
      }
    }
    this.request(param)
  }
}

export { Product }
